package Tests;

import system.BlogSystem;
import bean.BlogBean;
import bean.PostBean;
import bean.UserBean;
import dao.BlogDAO;
import dao.DAO;
import dao.PostDAO;
import dao.UserDAO;

public class UserStoryFacade7 {
	
	private BlogSystem system = BlogSystem.getInstance();
	private DAO<UserBean> userDAO;
	private DAO<BlogBean> blogDAO;
	private DAO<PostBean> postDAO;

	
	public void loadData(){
		userDAO = UserDAO.getInstance();
		blogDAO = BlogDAO.getInstance();
		postDAO = PostDAO.getInstance();
	}

	public String logon(String login, String senha) throws Exception {
		return system.login(login, senha);

	}
	
	public String getNumberOfBlogsByLogin(String login) throws Exception{
		return String.valueOf(system.getNumberOfBlogsByLogin(login));
	}
	
	
	public String getNumberOfBlogsBySessionId(String sessionId) throws Exception{
		return String.valueOf(system.getNumberOfBlogsBySessionId(sessionId));
	}

	public String getBlogBySessionId (String sessionId, int index) throws Exception{
		return system.getBlogBySessionId(sessionId, index);
	}
	
	public String getBlogByLogin(String login, int index) throws Exception{
		return system.getBlogByLogin(login, index);
	}
	
	public String getNumberOfPosts(String blogId) throws Exception{
		return String.valueOf(system.getNumberOfPosts(blogId));
	}

	public String getPost(String blogId,int index) throws Exception{
		return system.getPost(blogId, index);
	}

	//#o metodo changePostInformation sera responsavel por alterar apenas a parte textual de um post. 
	public void changePostInformation(String sessionId, String postId, String atributo, String valor) throws Exception{
		system.changePostInformation(sessionId, postId, atributo, valor);
	}
	
	public String getNumberOfSounds(String postId) throws Exception{
		return String.valueOf(BlogSystem.getInstance().getNumberOfSoundsOfPost(postId));
	}

	public String getNumberOfMovies(String postId) throws Exception{
		return String.valueOf(BlogSystem.getInstance().getNumberOfMoviesOfPost(postId));

	}

	public String getNumberOfPictures(String postId) throws Exception{
		return String.valueOf(BlogSystem.getInstance().getNumberOfPicturesOfPost(postId));
	}
	
	public String getMovie(String postId, long index) throws Exception {
		return system.getMovie(postId, index);

	}
	
	public void deleteMovie(String sessionId, String movieId) throws Exception{
		system.deleteMovie(sessionId, movieId);
	}

	public String getSound(String postId, long index) throws Exception {
		return system.getSound(postId, index);
	}
	
	public void deleteSound(String sessionId, String soundId) throws Exception{
		system.deleteSound(sessionId, soundId);
	}

	public String getPicture(String postId, long index) throws Exception {
		return system.getPicture(postId, index);

	}

	public void deletePicture(String sessionId, String pictureId) throws Exception{
		system.deletePicture(sessionId, pictureId);
	}

	public void logoff(String idSession) throws Exception{
		system.logout(idSession);
	}
	public void saveData(){
		
	}
}
